{extend name="pub/base2" /}
{block name="title"}
<title>小说编辑</title>
{/block}

{block name="body"}
<article class="clearfix pd-20">
    <form action="{:url('edit')}" method="post" class="form form-horizontal" enctype="multipart/form-data">
        <input type="hidden" value="{$book.id}" name="id">
        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>漫画名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$book.book_name}" name="book_name">
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>别名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$book.nick_name}" name="nick_name">
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>标识：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$book.unique_id}" name="unique_id">
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3">标签：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$book.tags}" placeholder="各个分类用|隔开" name="tags">
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3">题材：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box" style="width:150px;">
                    <select class="select" name="cate_id" size="1">
                        {volist name="cates" id="vo"}
                        <option value="{$vo.id}" {$book.cate_id==$vo.id?"selected":""}>{$vo.cate_name}</option>
                        {/volist}
                    </select>
				</span>
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>作者：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$book.author.author_name}" name="author">
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3">封面：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="file" name="cover" class="input-text">
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3">起始付费章节：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" name="start_pay" value="{$book.start_pay}" class="input-text">
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3">单章价格：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" name="money" value="{$book.money}" class="input-text">
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3">简介：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea name="summary" cols="" rows="" class="textarea"
                          dragonfly="true" onKeyUp="textarealength(this,100)">{$book.summary}</textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3">状态：</label>
            <div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
				<select class="select" name="end" size="1">
					<option value="2" {$book.end == 2?"":"selected"}>连载中</option>
                    <option value="1" {$book.end == 1?"selected":""}>已完结</option>
				</select>
				</span>
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3">是否推荐：</label>
            <div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
				<select class="select" name="is_top" size="1">
					<option value="2" {$book.is_top == 2 ? "" : "selected"}>否</option>
                    <option value="1" {$book.is_top == 1 ? " selected" : ""}>是</option>
				</select>
				</span>
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>

{/block}
{block name="script"}
<script>
    $(function () {
        $("form").validate({
            rules: {
                book_name: {
                    required: true,
                    minlength: 1,
                    maxlength: 50
                },
                tags: {
                    required: true
                },
                area_id: {
                    required: true
                },
                author: {
                    required: true
                },
                start_pay: {
                    required: true,
                    digits: true
                },
                money: {
                    required: true,
                    number: true
                },
                end: {
                    required: true,
                    digits: true
                }
            },
            onkeyup: false,
            focusCleanup: false,
            success:"valid"
        });
    });

</script>
{/block}